DT-RRNS: Routing Protocol Design for Secure and Reliable Distributed Smart Sensors Communication Systems

A smart city has a complex hierarchical communication system with various components. It must meet the requirements of fast connection, reliability, and security without data compromise. Internet of Things technology is widely used to provide connectivity and control solutions for smart sensors and other devices using heterogeneous networking technologies. In this paper, we propose a routing solution for Wireless Sensor Networks (WSN) and Mobile Ad hoc NETworks (MANET) with increasing speed, reliability, and sufficient security. Many routing protocols have been proposed for WSNs and MANETs. We combine the Secret Sharing Schemes (SSS) and Redundant Residual Number Systems (RRNS) to provide an efficient mechanism for a Distributed dynamic heterogeneous network Transmission (DT) with new security and reliability routing protocol (DT-RRNS). We analyze the concept of data transmission based on RRNS that divides data into smaller encoded shares and transmits them in parallel, protecting them from attacks on routes by adaptive multipath secured transmission and providing self-correcting properties that improve the reliability and fault tolerance of the entire system.


Introduction
Internet of Things (IoT) technology for a smart city is widely used to provide solutions for connecting smart things using heterogeneous networks and advanced communication technologies.
As the main assets, various city systems, objects, and sensors can act as distributed information systems generating data, i.e., power plants, schools, transport, law enforcement agencies, hospitals, and other public services. The main objective is to improve the living standard and urban service quality. The information gained from smart sensors allows us to analyze and manage the urban environment in real-time with a quick response. There are many scientific, commercial, and governmental solutions for implementing a smart city concept.
According to Deakin's generalized definition [1], a smart city is a city that uses an information system to meet the needs of city residents. It is not only a set of technological solutions but is the application of these technologies by local communities.

Data Transmission in IoT Networks
A wireless ad hoc network and MANET are important concepts of smart city communication. It is widely used for ensuring self-configuring and dynamic connectivity between sensors, humans, and devices that send and receive information.
Lobo et al. [10] study the Quality of Service of MANET in smart city networks with an emphasis on healthcare. Several frameworks were considered that improve the transmission quality of MANET, as well as individual elements, such as video signal transmission. Cardone et al. [11] discuss the MANET and WSN hybrid network for fast data collection in the smart city. The authors provide a transmission protocol based on modern data transmission standards considering IPv6. Pandey et al. [12] study methods to improve the reliability of MANET networks and propose a method of self-healing nodes.
In this work, our goal is to increase the speed and reliability of MANET communication to ensure security. To achieve this goal, we propose the use of RRNS in MANET.
In the original version, MANET solves the minimax optimization problem of finding the shortest path in the network. The smart city network can be represented as a directed graph, where the vertices are the communication nodes (devices in the network), and the arcs are the data transmission between the nodes. Let us establish that G(V, E) is a network graph with a flow v 0 ∈ V and path cost function c : E → R . We assume that the set of vertices V split into two non-overlapping subsets V A and V B ( Now, we fix a pair of mappings: where V G (v) is the set of ends of all arcs outgoing from a vertex v. We define the following subgraph T s = (V, E s ), generated by a set of arcs of the form (v, s A (v)) and (v, s B (V)). This subgraph has the property that for some given vertex w ∈ V, or there is a way P T , (w, v 0 ) from w to v 0 . For an arbitrary vertex, w ∈ V defines the value c(s A , s B , w) as the sum of the costs of the arcs of the path P T , (w, v 0 ), if such a path exists in T s . If the path P T , (w, v 0 ) does not exist in T s , we assume the value c(s A , s B , w) equals to ∞ or −∞ depending on the positivity and negativity of the sum of the costs of the arcs of the oriented cycle C w .
If the sum of the costs of the arcs of an oriented cycle C w is zero, then c(s A , s B , w) equals the sum of the costs of the arcs of the path connecting the vertex w with the cycle C w . That is, a problem is formulated as F(w) = min Let us consider the data transmission model presented in Figures 1 and 2. It is known that MANET transmits data using devices located on the infrastructure-less, distributed wireless networks without static-located transmission stations. It is an interesting and promising solution providing communication of a big variety of devices, from mobile devices to personal cars, from smart devices to public transport, etc. In addition, a smart city infrastructure also contains static nodes, such as data centers, storage, decision centers, etc.
For such a dynamic heterogeneous network, we propose the concept of parallel data transmission based on RRNS that divides data into smaller shares and transmits them in parallel. The self-correcting properties of RRNS can improve the reliability and fault tolerance of the entire system [13][14][15][16].
Figure 1 shows a conceptual model described above. We group the elements of a smart city according to common features. They can be separated from each other by large distances and distributed like data management modules.
This model gives a general idea of the transmission network complexity. Each group of components is connected to other groups, and control devices can communicate with any device on the network. In such a data transmission model, MANET provides a definite advantage. Devices, such as sensors, can send data to a destination, transmitting it through other devices within the network. Figure 2 shows the data transmission from the sensor to the recipient in the DT model. The recipient can be a data warehouse, decision center, data processing center, cloud data analysis, etc. RRNS transmits data in the MANET network in parallel breaking the message into several shares. It improves the speed at which data are transmitted across communication channels since such shares are smaller than the original message.
We use the term Weighted Number System (WNS) as a traditional positional decimal number system. Figure 2 shows the data transmission from the sensor to the recipient in the DT model. The recipient can be a data warehouse, decision center, data processing center, cloud data analysis, etc. RRNS transmits data in the MANET network in parallel breaking the message into several shares. It improves the speed at which data are transmitted across communication channels since such shares are smaller than the original message.
We use the term Weighted Number System (WNS) as a traditional positional decimal number system.     Figure 2 shows the data transmission from the sensor to the recipient in the DT model. The recipient can be a data warehouse, decision center, data processing center, cloud data analysis, etc. RRNS transmits data in the MANET network in parallel breaking the message into several shares. It improves the speed at which data are transmitted across communication channels since such shares are smaller than the original message.
We use the term Weighted Number System (WNS) as a traditional positional decimal number system.     Figure 3 shows the model of data transmission packets. The receiver collects shares of information and combines them. The application knows how many shares have arrived and how many shares should arrive. RRNS has self-correcting properties for recovering the message if one or several shares are lost or intentionally changed. If arrived shares are not enough, it waits a certain time, and the packet is requested again or ignored. As a result, we can have a network with increasing speed and reliability. and how many shares should arrive. RRNS has self-correcting properties for recovering the message if one or several shares are lost or intentionally changed. If arrived shares are not enough, it waits a certain time, and the packet is requested again or ignored. As a result, we can have a network with increasing speed and reliability.

DT Security and Reliability
Our main approach is to use RRNS to ensure the security of data transmission. Let us discuss and compare well-known solutions for providing reliability and security of distributed data storage and transmission. Four main methods are used to ensure reliability [17]: Replication, Erasure code, Erasure code modifications, and Error correction code.
Chang et al. [18] presented a modified data replication method, providing a high encoding and decoding speed. However, it requires additional cryptographic primitives to ensure security and has a high redundancy compared to erasure codes.
Many different modifications of erasure codes have been proposed to create reliable methods for DT. The joint use of error correction and erasure codes maintains system performance and minimizes the load on the data transmission network when recovering lost fragments [19,20].
Erasure codes based on the RRNS [21] allow data to be processed in the encoded form [14]. So, it can be used both in the design of low-power wireless data transmission devices and DT.
Secure DTs are based on the use of cryptographic primitives-symmetric encryption algorithms (AES) and digital signatures based on RSA (Rivest, Shamir, Adleman) [22]. The advantages of these approaches are high speed of encryption and decryption and low data redundancy. The disadvantage is that an error in the encrypted data leads to its loss. To eliminate this shortcoming, the use of additional mechanisms for accessing data for a long time is required [23].
An alternative approach is to use recovery codes [20], erasure codes, and error correction codes based on RRNS [19]. However, recovery codes and erasure codes do not allow encoded data processing. Homomorphic calculations process encoded data without additional computational costs for decoding. A significant breakthrough in the field of homomorphic computing came from the work of Gentry [32]. The authors proposed a fully homomorphic scheme to perform both

DT Security and Reliability
Our main approach is to use RRNS to ensure the security of data transmission. Let us discuss and compare well-known solutions for providing reliability and security of distributed data storage and transmission. Four main methods are used to ensure reliability [17]: Replication, Erasure code, Erasure code modifications, and Error correction code.
Chang et al. [18] presented a modified data replication method, providing a high encoding and decoding speed. However, it requires additional cryptographic primitives to ensure security and has a high redundancy compared to erasure codes.
Many different modifications of erasure codes have been proposed to create reliable methods for DT. The joint use of error correction and erasure codes maintains system performance and minimizes the load on the data transmission network when recovering lost fragments [19,20].
Erasure codes based on the RRNS [21] allow data to be processed in the encoded form [14]. So, it can be used both in the design of low-power wireless data transmission devices and DT.
Secure DTs are based on the use of cryptographic primitives-symmetric encryption algorithms (AES) and digital signatures based on RSA (Rivest, Shamir, Adleman) [22]. The advantages of these approaches are high speed of encryption and decryption and low data redundancy. The disadvantage is that an error in the encrypted data leads to its loss. To eliminate this shortcoming, the use of additional mechanisms for accessing data for a long time is required [23].
An alternative approach is to use recovery codes [20], erasure codes, and error correction codes based on RRNS [19]. However, recovery codes and erasure codes do not allow encoded data processing. Homomorphic calculations process encoded data without additional computational costs for decoding. A significant breakthrough in the field of homomorphic computing came from the work of Gentry [32]. The authors proposed a fully homomorphic scheme to perform both addition and multiplication. The main disadvantages of this algorithm are significant data redundancy and lack of control over the results of arithmetic operations.
Particular attention should be paid to the distributed data storage model proposed in [33], guaranteeing security, privacy, homomorphism, reliability, and scalability. The authors propose two approaches to building systems based on homomorphic access structures in RRNS, with RRNS moduli being used as secret keys stored by users. Data processing leads to an exponential increase in the load on the network and memory, which makes this model inapplicable in practice in modern conditions. Access structures [34,35] ensure data security and confidentiality. RRNS implements the same functionality as the Mignotte scheme but allows you to control the results of data processing. DT is also characterized by collusion risks [36]. Several approaches have been developed to prevent cloud collusion [26]. As mentioned above, the non-stationarity of the cloud environment reduces the efficiency, performance, reliability, and security of the system. The adaptive paradigm reduces uncertainty but is rarely used in cloud computing [36].
Let us consider the following scenario. The user has confidential data and decides not to send it using a single path. He divides them into several shares and transmits them in different paths between nodes. There are several types of security threats in this scenario.
Deliberate threats include unauthorized access to information, interception, falsification, hacker attacks, etc., in one or more nodes.
Random threats include errors, crashes, etc. They can lead to the loss of one or more shares of data, inconsistencies between different copies of the same data, and/or the inability to recover the original data. Collusion threats are illegal agreements between two or more adversaries (in the context of different paths between nodes, the adversaries are nodes) to gain full access to personal data. Cryptographic protocols can be used to mitigate the risks of deliberate threats, but this is not enough for random threats.
We consider reliability and security as close concepts of an information violation. Therefore, statements related to reliability are used to discuss security and vice versa.
To improve the security and reliability of data transmission systems, DT is based on access structures and error correction codes. It transmits data through various paths between nodes and minimizes the chance of information theft or loss in case of intentional and accidental threats.
In the next sections, we show how the size of shares and their number can change the reliability, security, speed, etc. of data transmission. These structures reduce the load on the transmission network compared to the classical replication mechanism and reduce the cost.

Residue Number System and Secret Sharing
(k, n)-RRNS is determined by a system of pairwise coprime moduli {p 1 , p 2 , . . . , p n }. Positional integer number s such that 0 ≤ s < P, where P = ∏ k i=1 p i , is represented as a tuple of n numbers s RRNS → (s 1 , s 2 , . . . , s n ), where n = k + r and s i = smodp i , i = 1, 2, . . . , n. ( RRNS is a redundant representation of the Residue Number System (RNS). Redundancy is represented by additional moduli in the moduli set. k is the RNS dimension; r is the dimension of redundant moduli; and n is the RRNS dimension. According to the RRNS property, if the number of moduli is r, then it can detect r and correct r/2 errors.
Redundancy supports reliable data processing and transmission systems with multiple error detection and correction. To detect and correct errors in RRNS, several methods are used, for instance, syndrome and projection methods [28,29]. If we consider RRNS not only as the error detection, localization, and correction code but also as the Mignotte SSS, then we can conclude that RRNS ensures data security.
RRNS has many applications because of its properties such as parallelism and modularity, among which we can mention hardware and software acceleration, information integrity control, digital signal processing, increasing the robustness of information transmission between computers, etc. Modular calculus is based on the Chinese Remainder Theorem (CRT) [28], according to which the number s can be uniquely calculated by the formula where This method is called the CRT method or the Garner method. However, it is computationally complex, since it requires division by a sufficiently large number P. It is worth noting that there are many well-developed methods for an efficient implementation of calculating the remainder of the division and converting numbers back from RRNS to a WNS. It makes this system suitable for use as the basics of a SSS [15,26,28].
Let us consider SSSs using Shamir's threshold scheme as an example [27]. The idea of this scheme is that the secret is represented as a polynomial k − 1 degrees. Then, to interpolate the resulting polynomial, it is necessary k points, and the polynomial can be divided into n shares. Then, the secret-sharing process is as follows. Let we need to divide the secret s on n shares. To do this, take a prime number p > s. The following polynomial is constructed: where a k−1 , a k−2 , . . . , a 1 -random numbers that are only known when the secret is shared. The secret recovery occurs due to the calculation of the Lagrange interpolation polynomial according to the following formula: where (x i , y i )-polynomial point coordinates. In addition, there is a limitation: all calculations are performed only in the final field p. In this scheme, an integer polynomial is used. Despite the low redundancy and high scalability, the field space p is not used efficiently. This scheme was developed by Hugo Krawczyk in 1993 [37]. In this scheme, integer coefficients are shares. It is a (k, n) threshold SSS. It distributes s among k participants randomly. The recovery of the secret is possible from k shares, while k − 1 shares do not allow you to recover s.
Let us consider the Information Dissemination Algorithm designated as IDA (Algorithm 1). This algorithm works for parameters n (total number of shares) and k (required number of shares for recovery). It includes a secure encryption function with a private key, which is designated as ENC. In addition, the algorithm implements a computationally secure (k, n) SSS. It is also worth noting that the space of both the secret and the message in this scheme is the same as for the encryption function ENC. Algorithm 1. Secret Sharing of Krawczyk scheme.
1. Choosing a random encryption key K; secret s is encrypted by ENC, e = ENC K (s). 2. e is divided into n fragments-e 1 , e 2 , ..., e n by the scheme. 3. K is represented as a tuple of n numbers K 1 , K 2 , . . . , K n by Asmuth-Bloom SSS. 4. Shares m i = (e i , K i ), i = 1, n are distributed between participants In Algorithm 2, every share m i has a bit length |e i | + |K i |, where |x| is a bit number of x. Evidence of this, as well as confirmation of the secrecy of the scheme, is given in [38]. 1. k participants combine their shares m i j = e i j , K i j with indexes {i 1 , i 2 , . . . , i k } together 2. e is recovered from shares e i j . 3. key K is recovered from K i j by Asmuth-Bloom 4. Using K, e is decrypted then s is recovered.
Despite the obvious advantages of these schemes (low redundancy, scalability, flexibility), they have several disadvantages, such as the inability to add new participants without recovering the secret and re-sharing it which is important for smart city infrastructure. The advantages and limitations of the DT-RRNS scheme are discussed in the next sections.

Secret Sharing Scheme with Residue Number System
In this section, we introduce the basic concepts of security of two well-known SSS based on RRNS: Asmuth-Bloom and Mignotte.
Let each participant have a unique number or identifier. The entire set of these numbers we call the universal set of numbers and denote U (in the simplest case U = {1, 2, . . . , n}, where n is the number of participants in the scheme).
The set of authorized (qualified) coalitions is called the authorized subsets of U denoted by I. Participants of the qualified subsets can recover the secret from their shares when they act together to pool their knowledge.
An unauthorized subset is a subset I of participants of any coalition that does not have the right to recover the secret.
In the Asmuth-Bloom scheme, p 0 is a secret key, and s ∈ [0, p 0 ). The moduli The last inequality is usually called the Asmuth-Bloom condition. At the stage of sharing the secret, a random number r n is generated such that s = s + r n p 0 < ∏ k i=1 p i . Secret s is divided so that s i = s modp i is a share for participant i, where i = 1, 2, . . . , n. Any set of authorized participants with numbers from I can recover the secret; wherein n ≥ |I| = m ≥ k.
Using the CRT, s is recovered based on its RRNS representation s i 1 , s i 2 , . . . , s i m with moduli p i 1 , p i 2 , . . . , p i m , where i j ∈ I, for all j = 1, 2, . . . , m. s is recovered as the remainder of the division of s on p 0 : s = s mod p 0 .
Let us consider an unauthorized coalition of participants with numbers from I. Then I ≤ k − 1, let P = ∏ k i=1 p i and P = ∏ i∈ I p i . In this case, s = s mod P. According to the Asmuth-Bloom conditions P/ P > p 0 and P, p 0 = 1. Thus, as shown in [34], an unauthorized coalition obtained fewer than k shares does not receive any useful information about the secret.
In the Mignotte (k, n) threshold scheme, moduli p 1 < p 2 < . . . < p k < p k+1 < . . . < p n are chosen to satisfy the inequality: To achieve security, secret s has to be in the interval (α, β). Any set I of authorized participants can recover the secret, wherein |I| = m ≥ k. s is recovered by CRT using s i 1 , s i 2 , . . . , s i m and moduli p i 1 , p i 2 , . . . , p i m , where i j ∈ I, for all j = 1, 2, . . . , m.
To ensure security, Mignotte sequences with a large value (β − α)/β should be used [35]. This scheme is not computationally secure but has practical applications due to reduced redundancy compared with Asmuth-Bloom.
Let us consider the concept of entropy, which plays an important role in SSS security theory.
We denote the entropy of the secret as H(s) = log 2 s. In this case, the entropy is maximum. Knowing the subset of the shares s * = s i 1 , s i 2 , . . . , s i m , we denote entropy as H(s * , I) = min(log 2 s, ∑ i∈I log 2 p i ), where ∀j : i j ∈ I and |I| = m. If I is the set of authorized participants, then H(s * , I) = H(s) = log 2 s. The important characteristic of the SSS is the uncertainty of the secret that is defined by SSS is computationally secure if ∆ s, s * , I = H(s) for all I, where I is the set of unauthorized participants. For the set of authorized participants, the secret can be recovered correctly; hence, the uncertainty is equal to: To analyze the security of SSS based on RRNS, an additional concept of the perfect SSS was introduced in [38]. SSS is called perfect if any unauthorized subset participants cannot obtain any information about the secret. Hence, the scheme is perfect if, for all unauthorized subsets of participants with numbers I and for any ε > 0, there is s, such that, The scheme is called ideal if the space of share has the same dimension as the secret space. An ideal SSS is perfect with the smallest possible size of each share.
The question of how exactly it is necessary to choose the parameters of the SSS on the RRNS so that it has the asymptotic idealness property remains open. In [38], the authors show the asymptotic idealness of the Asmuth-Bloom scheme using "sufficiently close" coprime numbers for RRNS moduli. The work [39] considers so-called compact sequences of coprime numbers with an initial value p 0 when p n < p 0 + p θ 0 for some real number θ ∈ (0, 1). In the following analysis, we assume that the compact sequences of coprime numbers are used as the moduli sets.
Let us now consider the concept of computationally secure SSS. Assume that at some point in time, unauthorized participants collect several shares with numbers I. The objective of the unauthorized participants is to recover the secret based on the available data.
Let S be a universal set of all subsets of possible secrets recovered from all available shares. S can be divided into two subsets. First subset S 1 consists of all possible secrets that cannot be used to obtain the secret. The second subset S 2 contains all remaining possible secrets. For example, if the Mignotte scheme knows the share of the secret s j for modulo p j , 0 ≤ j ≤ n, then the secret must satisfy the condition: s ≡ s j modp j . Therefore, in this case, S 1 = {s : s ∈ S ∧ s ≡ s j modp j } and S 2 = s : s ∈ S ∧ s ≡ s j modp j . Note that if the SSS is perfect, then S 1 = ∅ and S 2 = S.
Thus, to obtain the original secret, it is necessary to use all combinations of indexes included in S 2 and the security of the scheme depends on the cardinality of this set and the computational complexity of the complete permutation.
It is necessary to generate the scheme parameters in such a way that unauthorized participants cannot, using modern computing resources, obtain the secret in a reasonable time. A scheme that meets these conditions is called a computationally secure scheme. As a measure of computationally secure, we take the cardinality of the set S 2 : For the Asmuth-Bloom scheme, considering its asymptotic idealness, and Asmuth-Bloom condition, f ( I) = |S| ≤ p 0 for I.
Computationally secure schemes are not always ideal but have reduced redundancy, which is important in practical applications.

Data Transmission Security and Reliability
Let us consider parameter generation, secret sharing, and secret recovery for threshold (k, n)-DT-RRNS.

Statement 1.
In DT-RRNS, for any unauthorized subset of participants with numbers I, P > P = ∏ i∈ I p i and p 1 > 2 k−1 .
Proof. Using the fact that in threshold SSS the maximum unauthorized subset is the subset numbered n, n − 1, . . . , n − k + 2 and considering the definition of compact sequences, we obtain: On the other hand, P > p k 1 . From here To comply with the condition P > P it is necessary to fulfill the inequality P/ P > 1. This inequality will necessarily hold if the inequality p 1 2 k−1 > 1, or which is equivalent, p 1 > 2 k−1 . The statement is proven.
In other words, the DT-RRNS is applicable when choosing a module p 1 at the parameter generation stage such that p 1 > 2 k−1 .

Statement 2.
For DT-RRNS, when combining the shares of an unauthorized subset of participants of I, the cardinality of the enumeration set f I is determined by the expression: where P = ∏ i∈ I p i .
Proof. Since the shares, whose numbers belong to I, are known, then for all p i j such that i j ∈ I, it is possible to recover the number s ≡ s mod P due to s = a P + s. The only unknown secret parameter is a ∈ Z. Let us define the upper and lower bound of a. s is defined with dynamic range P.
Taking into account that s and a are non-negative and since s < P and P P − 1 < P− s−1 P That is, a lies in between 0, P− s−1 P , whose cardinality is f I = P− s−1 P + 1, The statement is proven.
Let us study how the cardinality of the enumeration sets of the Asmuth-Bloom scheme and DT-RRNS are related to RRNS parameters. The Asmuth-Bloom scheme is determined by the set of moduli p 0 < p 1 < p 2 < . . . < p k < p k+1 < . . . < p n . To ensure the asymptotic ideality of the Asmuth-Bloom SSS, we require that this sequence be compact with the initial value p 0 , or p n < p 0 + p θ 0 for θ ∈ (0, 1). In this case, the sequence p 1 < . . . < p n will be compact with the initial value p 1 . This RRNS will be used as the basis for the proposed DT-RRNS.
The cardinality of the Asmuth-Bloom enumeration set is constant and equal to p 0 .
I max is a set of unauthorized subsets numbers with the largest range P max , then, Establish a relationship between the value f I max and k. Let us consider two SSSs with a threshold k and n − k + 1, assuming 2 ≤ k ≤ n 2 . Let us calculate P P max for the second SSS: Sensors 2023, 23, 3738

of 23
The expression on the right is the value P P max for the first SSS. Therefore, the values P P max symmetrical in k regarding the meaning n 2 . Let now 2 ≤ k < n 2 and k 1 = k + 1. Let now f k 1 = P P max for a threshold k 1 . Let us estimate the value f k 1 : where f k represents the value P P max for SSS with threshold k. Because 2 ≤ k < n 2 , then, n − k + 2 > n 2 , therefore, n − k + 2 > k + 1. Considering the restrictions imposed on the RRNS moduli, we have p n−k+2 > p k+1 , therefore, p n−k+2 p k+1 > 1. Given the above considerations, we obtain that f k 1 < f k . In other words, the worst case in which P P max takes the smallest value is the case k = n 2 . Because of the symmetry P P max relative to this value, it is advisable to consider k within the borders 2, n 2 , as for the interval n 2 , n − 1 reasoning proceeds in a similar way. A special case is SSS in which k = n and P P max = 1.
Next, we prove several important statements that accurately estimate f I max .

Statement 3.
For any sequence p 1 < p 2 < . . . < p n follows that Proof. From Statement 2, it follows Expression (20) shows the upper bound for f ( I max ). To estimate the lower bound f I max , we prove the following statement.

Proof.
Since the sequence is compact with the initial value p 1 , then On the other hand, since the sequence is increasing, then P > p k 1 . Consequently from which the inequality (21) follows. The statement is proven. Based on Statements 3 and 4, let us accurately determine the boundaries for the quantity P P max , which directly depends on the value p 1 . Let us consider an example that shows how fast the value P P max converges to p 1 . Figure 4 shows . R shows the relation of f I max and p 1 . This relation assesses how parameter a affects security by approaching the value of b by using compact sequences for various p 1 . We see that with increasing p 1 , R approaches 1, and, therefore, P P max approaches p 1 . In this case, Equation (22) Figure 4 shows that the higher the value of 1 , the closer (̃) to it. Thus, with a higher value of 1 , the DT-RRNS has higher security. Statement 4 is important for estimating security. At fixed and , magnitude (̃) =̃ is within the following limits: It is easy to show that for fixed 0 < < 1 and 2 ≤ ≤ lim 1 →∞ ( 1 1 + 1 −1 ) −1 = 1 and 1 1 + 1 −1 < 1. Consequently, ( 1 where 0 < < 1. And the more 1 , the closer to 0. Then from (24) it follows Based on this expression, one can obtain the following estimate for (̃): The last inequality determines the degree of closeness of the quantity (̃) to 1 without generating the sequence itself. Because 1 > 0 then due to restrictions imposed on ̃, with an increasing number 0 , the cardinality (̃) of the enumeration set of DT-RRNS approaches 1 . We can conclude that the cardinality of the brute force set for the DT-RRNS when choosing sufficiently large moduli is equivalent to the cardinality of the brute force set of the Asmuth-Bloom scheme, which is equal to 0 .
Let us now compare the DT-RRNS with the Mignotte scheme. The basic design requirement of the Mignotte scheme is the inclusion of a secret into the interval ( = ∏ − −2 =0 , = ∏ =1 ). The statements proved earlier regarding the size of the set of enumerations of the DT-RRNS allow us to deviate from this rule in favor of increasing the dynamic range of the secret representation. Based on the assumption of a uniform distribution of the secret in the interval [0, ), compactness of the set 0 < 1 < ⋯ < and a sufficiently large number 0 , it is easy to show that the probability of a secret falling into the interval [0, ) approaches the probability of "guessing" an arbitrary secret in the  Statement 4 estimates the proximity of the cardinality of possible secrets f I max to p 1 depending on the p 1 , θ, k, and n given before generating the sequence itself. Figure 4 shows that the higher the value of p 1 , the closer f I max to it. Thus, with a higher value of p 1 , the DT-RRNS has higher security. Statement 4 is important for estimating security. At fixed θ and k, magnitude f I max = P P max is within the following limits: It is easy to show that for fixed 0 < θ < 1 and 2 ≤ k ≤ n lim p 1 →∞ 1 1 + p θ−1 1 k−1 = 1 and 1 Consequently, where 0 < ε < 1. And the more p 1 , the closer ε to 0. Then from (24) it follows Based on this expression, one can obtain the following estimate for f I max : The last inequality determines the degree of closeness of the quantity f I max to p 1 without generating the sequence itself. Because p 1 > p 0 then due to restrictions imposed , with an increasing number p 0 , the cardinality f I max of the enumeration set of DT-RRNS approaches p 1 . We can conclude that the cardinality of the brute force set for the DT-RRNS when choosing sufficiently large moduli is equivalent to the cardinality of the brute force set of the Asmuth-Bloom scheme, which is equal to p 0 .
Let us now compare the DT-RRNS with the Mignotte scheme. The basic design requirement of the Mignotte scheme is the inclusion of a secret s into the interval The statements proved earlier regarding the size of the set of enumerations of the DT-RRNS allow us to deviate from this rule in favor of increasing the dynamic range of the secret representation. Based on the assumption of a uniform distribution of the secret in the interval [0, P), compactness of the set p 0 < p 1 < . . . < p n and a sufficiently large number p 0 , it is easy to show that the probability of a secret falling into the interval [0, α) approaches the probability of "guessing" an arbitrary secret in the Asmuth-Bloom scheme. Note that in the notation used, α = P max and β = P. Indeed, the secret in the Asmuth-Bloom scheme is in the range 0, p 0 and is determined by p 0 . With a uniform distribution of the secret on this set, the probability of choosing an arbitrary secret is 1 p 0 . On the other hand, the probability of a number falling into the interval [0, α) = 0, P max is equal to |[0, P max )| |[0,P)| Pmax P . According to Statement 3, for a sufficiently large p 0 , the magnitude P P max is equivalent to p 0 .
It follows that parameters that are determined by DT-RRNS can eliminate restrictions imposed on the parameters of the Mignotte scheme. Let us consider examples of generating DT-RRNS parameters.
Example 1. Let p 1 = 1024, n = 10, and k = 5, and let it be required that the deviation from the Asmuth-Bloom search power does not exceed 10%. Determine what should be θ in this case. According to estimates (24) and (28), we obtain: whereεis a required deviation. In our case,ε = 0.05.
Substituting the available data into the formula, we have θ < 0.477. Consequently, the numbers that provide the required cardinality of the enumeration set must be within the interval [1024, 1051). Using Statement 4, we have f I max > p 1 1 Fewer unique divisors of p 1 , the more beneficial to use them for building a compact sequence. It increases the number of the coprime numbers in the interval from p 1 to 2p 1 .
It is worth noting that the proof of the possibility of generating compact sequences is a difficult number-theoretic problem.
The generation of a variety of compact sequences is the subject of further research. Now, we can limit ourselves to practical recommendations, which consist in choosing sufficiently large p 1 and with the least number of divisors.
Statements 1-4 evaluate the security of the DT-RRNS scheme. First, according to Statement 1, p 1 > 2 k−1 determines a lower bound of p 1 . For maximum security, p 1 must be significantly higher than 2 k−1 . Secondly, an important parameter of the scheme is the value θ, defining a compact sequence. The closer θ to zero, the better the SSS properties in terms of security, which follows from Statement 4 and inequality (24).

Security of Data Transmission
The RRNS allows the implementation of the integrity, availability, and confidentiality of data by a single mechanism. These features provide an efficient way to ensure reliability and security during data transmission in MANET.
This section discusses the principles on which the proposed method of data transmission in a non-hierarchical network is based.
To meet MANET requirements, we choose a symmetric encryption scheme, a secure RRNS with a compact set of moduli {p 1 , p 2 , . . . , p k , p k+1 , . . . , p n }, for which p n < p 1 + p θ 1 , where 0 < θ < 1. To provide the required level of security, the moduli must be close in size to each other.
The combined use of multipath routing, a secure sharing scheme, and the error correction capabilities of RRNS create the conditions for using a new approach to data transport that guarantees transmission reliability and security.
The main principles of the proposed approach: 1. Data are encrypted by a symmetric encryption algorithm and key K.

2.
The encrypted data are represented as a set of n RRNS shares by dividing it on moduli {p 1 , p 2 , . . . p k , p k+1 , . . . , p n }.

3.
Key K is divided based on the perfect Asmuth-Bloom scheme to guarantee a high level of key security.

4.
Shares of the secret, which consist of a share of the key and data shares, are sent by a separate route that is associated with this modulo and obtained according to an algorithm with the possibility of multipath routing with division by nodes.

5.
If some of them could not be delivered within the given waiting period, the receiving node carries out a verification procedure, which is based on the ability of the RRNS to correct and control data integrity. 6.
After checking secret shares for correctness and integrity, the receiving node performs a recovery procedure. 7.
To recover the original data, the receiver needs to recover the secret key from key shares and decrypt the data using the obtained key. Figure 5 shows a generalized scheme of the proposed method of data transmission based on encryption, encoding, and data sharing using RRNS. The key is generated first since its size affects the redundancy of the scheme and, therefore, the overall network load. 4. Shares of the secret, which consist of a share of the key and data shares, are sent by a separate route that is associated with this modulo and obtained according to an algorithm with the possibility of multipath routing with division by nodes. 5. If some of them could not be delivered within the given waiting period, the receiving node carries out a verification procedure, which is based on the ability of the RRNS to correct and control data integrity. 6. After checking secret shares for correctness and integrity, the receiving node performs a recovery procedure. 7. To recover the original data, the receiver needs to recover the secret key from key shares and decrypt the data using the obtained key. Figure 5 shows a generalized scheme of the proposed method of data transmission based on encryption, encoding, and data sharing using RRNS. The key is generated first since its size affects the redundancy of the scheme and, therefore, the overall network load.
Shares are moved along one of the previously constructed routes without crossing the nodes. After receiving all or part of the shares of the secret, the receiver recovers the secret by performing the error-correcting decoding procedure. The original secret is obtained by decrypting the data decoded from the RRNS using the encryption key. To balance the network load, a weighted SSS is used [39]. The route weight, route length, and route reliability (if a secure routing algorithm is used) can be adapted by changing RRNS parameters.
For example, the shortest route can be associated with the largest RRNS modulo. In this case, the message of this route will be the largest, but the transmission along it will be faster. By associating moduli with routes, we can achieve an increase in the quality and speed of transmission and an overall offload of the data transmission network.
The share of the secret that is represented by the smallest modulo carries less information about the original secret relative to the information by the larger modulo. This feature is applicable to change the flow of information to increase the security of data transmission, transporting the smallest share of the secret along the least reliable route according to some criterion.
The proposed approach is characterized by a combination of reliability and security, Shares are moved along one of the previously constructed routes without crossing the nodes. After receiving all or part of the shares of the secret, the receiver recovers the secret by performing the error-correcting decoding procedure. The original secret is obtained by decrypting the data decoded from the RRNS using the encryption key.
To balance the network load, a weighted SSS is used [39]. The route weight, route length, and route reliability (if a secure routing algorithm is used) can be adapted by changing RRNS parameters.
For example, the shortest route can be associated with the largest RRNS modulo. In this case, the message of this route will be the largest, but the transmission along it will be faster. By associating moduli with routes, we can achieve an increase in the quality and speed of transmission and an overall offload of the data transmission network.
The share of the secret that is represented by the smallest modulo carries less information about the original secret relative to the information by the larger modulo. This feature is applicable to change the flow of information to increase the security of data transmission, transporting the smallest share of the secret along the least reliable route according to some criterion.
The proposed approach is characterized by a combination of reliability and security, which are achieved due to several factors. Reliability is based on multipath routing and the RRNS error correction code.
The reliability of a set of routes W depends on the reliability of all constructed routes as follows [3]: where Π ω S,D (t) = ∏ {a,b}∈ω A a,b (t)-reliability of a single route ω ∈ W, which is the product of the availability A a,b of each of the connections between the nodes a and b at a certain point in time t.
We see that with an increase in the number of routes, the reliability of data transmission increases. In addition, RRNS increases the reliability of data transmission due to excessive noise-resistant coding. RRNS controls not only the situation with the loss of availability of an individual node and connectivity but also damage due to failures and intentional distortion of information.

Security Analysis
Now, let us consider the security of data transmission through MANET by the proposed method. As noted earlier, security is based on the strength of the RRNS-SSS. The computationally secure SSS has a sufficient level of security without leading to high redundancy, unlike ideal SSSs [39]. Due to the properties of RRNS, this scheme allows not only secure data transmission in networks but also load balancing using distributed transmission of data divided into small shares.
The strength of a particular network configuration depends on the resistance of each node to capture, the network topology, the number of node-separated routes built, the configuration of the SSS, and the moduli selection of the RRNS. It is necessary to consider that the condition for data interception (and at the same time confidentiality violation) is the interception of any number of nodes on n or more routes. Because it is not known in advance which nodes will be intercepted, it is impossible to select and exclude a compromised route in the data transmission protocol.
Let us introduce the following notations: Pr-the probability of secure data transmission when data will not be intercepted during the time interval T 0 . Pr node -the probability of the node attack-resistance (the probability that during the time interval T 0 the data on the node will not be intercepted). Q z -the probability of interception of z nodes. E z -the probability of secret loss with z intercepted nodes. Pr z -the probability of secure data transmission with z intercepted nodes node ij ,-node j in the route i. Z-the total number of nodes. z-number of intercepted nodes.
Let us consider the probability Pr for the example of the network with the same number of nodes on each route. Note, that it can be extended to the case with an arbitrary number of nodes on each route.
Let us have four possible data transmission routes (Figure 6), each of which has two nodes, with Pr node = 0.99. We use a suitable RRNS configuration (3,4) with three working and one redundant modulo. The number of possible permutations of 8 nodes taken 3 intercepted at a time that leads to loss of secret (we denote this value by 3 ), multiplied by the probability of intercepting exactly three nodes, gives the probability Pr 3 of intercepting data when intercepting any three nodes: If exactly four nodes were intercepted, then there are also two options: • An attacker will be able to recover the original data, for example, if the intercepted nodes are node 11 , node 12 , node 21 , node 42 ; • The attacker will not be able to recover the original data, for example, if the intercepted nodes are node 11 , node 12 , node 21 , node 22 . The number of combinations 4 of the four captured nodes, allowing you to recover the original data, multiplied by the probability of intercepting exactly four nodes, will give the probability of intercepting data if any four nodes are intercepted: For example, if 4 = 64 then Pr 4 = 6.147814464 × 10 −7 .
Special attention deserves the case if five or more nodes are intercepted. In the described situation, any set of captured nodes will provide attackers with a means to recover the original data. For situations of this kind, the number of combinations of received nodes that are needed to recover the original message will be equal to the total number of permutations with repetitions of 8 nodes of 5, 6, 7, and 8, respectively. Calculated values: The probability of interception is 1-Pr. The interception of data at any of the nodes of the route means the loss of confidentiality of the data transmitted by this route.
To intercept the secret, at least three different routes must be intercepted (according to the number of moduli k = 3, the minimum necessary for recovery). Therefore, the probability of interception when less than three nodes are intercepted is zero.
If exactly three nodes are attacked, then there are two options: • An attacker will be able to recover the original message, for example, if nodes are node 11 , node 21 , node 42 ; • An attacker will not be able to recover the original message, for example, if nodes are node 11 , node 12 , node 22 .
The number of possible permutations of 8 nodes taken 3 intercepted at a time that leads to loss of secret (we denote this value by E 3 ), multiplied by the probability of intercepting exactly three nodes, gives the probability Pr 3 of intercepting data when intercepting any three nodes: where Q 3 = (1 − Pr node ) 3 Pr 5 node -the probability of intercepting exactly three nodes. In general, the probability Q z of interception z nodes are calculated considering the formula: For example, if E 3 = 32, then If exactly four nodes were intercepted, then there are also two options: • An attacker will be able to recover the original data, for example, if the intercepted nodes are node 11 , node 12 , node 21 , node 42 ; • The attacker will not be able to recover the original data, for example, if the intercepted nodes are node 11 , node 12 , node 21 , node 22 .
The number of combinations E 4 of the four captured nodes, allowing you to recover the original data, multiplied by the probability of intercepting exactly four nodes, will give the probability of intercepting data if any four nodes are intercepted: For example, if E 4 = 64 then Pr 4 = 6.147814464 × 10 −7 .
Special attention deserves the case if five or more nodes are intercepted. In the described situation, any set of captured nodes will provide attackers with a means to recover the original data. For situations of this kind, the number of combinations of received nodes that are needed to recover the original message will be equal to the total number of permutations with repetitions of 8 nodes of 5, 6, 7, and 8, respectively. Calculated values: E 5 = 56, E 6 = 28, E 7 = 8, E 8 = 1, Then, guided by the approach proposed earlier, we obtain that Pr 5 = 5.434 × 10 −9 , Pr 6 = 2.744 × 10 −11 , Pr 7 = 7.92 × 10 −14 и Pr 8 = 10 −16 .
Using the results of probability calculations for each of the cases, it is possible to isolate the overall probability of intercepting data: It turns out that the probability Pr of secure data transmission is Pr = 0.999968948 for Pr node = 0.99. Table 1 shows the probability Pr of secure data transmission in MANET with redundant (3,4)-RRNS four possible data transmission routes and two nodes on each of the routes, for different values of Pr node .  Table 1 shows that for z = 0, 1, 2 the probability Q z is high. However, data transmitted by DT-RRNS are not intercepted. If z ≥ 3 and Pr node ≥ 0.7, probability Q z ≤ 4.537 × 10 −3 , which reduces the probability of secure data transmission Pr z .
We note that with increasing the number of possible routes and corresponding changing RRNS parameters, the probability of a secure data transmission increases. Table 2 shows that the probability of a secure transmission grows quite fast with increasing (k, n) parameters and number of nodes, even for the high probability of the resistance of the node to data interception Pr node = 0.99.

Performance Analysis
In this section, we compare two SSS-RRNS solutions: well-known Asmuth-Bloom and DT-RRNS. To measure encoding time, decoding time, and redundancy, we transmit data from 6 MB to 146 MB across a network of 16-24 nodes with 4 neighboring nodes, using a number of moduli from 4 to 6. The secret key used for the schemes is 2147483659. Table 3 and Figure 7 show the encoding and decoding time, and redundancy for the Asmuth-Bloom and DT-RRNS schemes with varying data sizes and the number of moduli. We see that the encoding and decoding times increase linearly for both Asmuth-Bloom and DT-RRNS.  DT-RRNS shows better runtime results than Asmuth-Bloom. DT-RNS for the largest data size has less time than Asmuth-Bloom for the smallest data size when using 6 moduli. The redundancy for DT-RRNS is approximately the same for all moduli sets and data sizes. The redundancy of the Asmuth-Bloom is increasing with the number of moduli increasing.  Table 4 contains the moduli used in the experiment.  Figure 7 shows the encoding time (a) and decoding time (b) versus the number of moduli and data size. Figure 8 shows the redundancy versus the number of moduli and data size. DT-RRNS has lower redundancy close to 1. We see that the redundancy of both Asmuth-Bloom and DT-RRNS weakly depends on the input data. It varies with scheme parameters.  We see that the proposed DT-RRNS has several advantages. It increases the speed of the system. The encoding time is in the range of 1 to 180 ms, while Asmuth-Bloom is between 40 and 1100 ms. It has reduced data redundancy while maintaining the same level of security and reliability.  Table 4 contains the moduli used in the experiment.  Figure 7 shows the encoding time (a) and decoding time (b) versus the number of moduli and data size. Figure 8 shows the redundancy versus the number of moduli and data size. DT-RRNS has lower redundancy close to 1. We see that the redundancy of both Asmuth-Bloom and DT-RRNS weakly depends on the input data. It varies with scheme parameters.  We see that the proposed DT-RRNS has several advantages. It increases the speed of the system. The encoding time is in the range of 1 to 180 ms, while Asmuth-Bloom is between 40 and 1100 ms. It has reduced data redundancy while maintaining the same level of security and reliability.

Concluding Discussion
Large-scale data sharing in a distributed smart city environment requires an increased attention to data security and reliability issues. Methods that ensure data security at the required level with high reliability and speed are very important. We see that the proposed DT-RRNS has several advantages. It increases the speed of the system. The encoding time is in the range of 1 to 180 ms, while Asmuth-Bloom is between 40 and 1100 ms. It has reduced data redundancy while maintaining the same level of security and reliability.

Concluding Discussion
Large-scale data sharing in a distributed smart city environment requires an increased attention to data security and reliability issues. Methods that ensure data security at the required level with high reliability and speed are very important.
In this work, we propose a DT-RRNS routing solution for the WSN and MANET complex dynamic hierarchical heterogeneous networks for improving data transmission. To design efficient mechanisms, we consider reliability and security as close concepts. Increased security and reliability are achieved with an effective data recovery mechanism of RRNS with moduli of compact sequences of coprime numbers.
This mechanism together with adaptive multipath routing increases the resistance of the sensor network to attacks of various types, including unauthorized interception, message falsification, errors, node and network connection failures, information loss in case of attacks or accidents, etc.
This approach does not have the limitations of the traditional encryption methods for secured data transmission. The secret key management is solved by the SSS.
In addition, this solution reduces data redundancy, resulting in less use of large equipment, energy consumption, and message storage capacity. These properties are important when deploying IoT.
In the DT-RRNS, each participant receives shares of a smaller size than the original data. It improves transmission speed, resulting in better support for big data sensing and processing, in contrast to the Asmuth-Bloom scheme.
The promising direction for future work is the development of computationally efficient methods for generating dynamic RRNS parameters and dynamic routes due to loss of sensors, connections, loss of functionality, errors by contamination, vibration, shocks, high temperatures, etc. It is important to study the problem of selecting moduli for dynamic adaptation to changing network topology and characteristics. To further improve efficiency and reliability, we will consider specialized multipath routing protocols based on a weighted version of DT-RRNS.